<?php

/**
 * Class Error
 *
 * Please note:
 * Don't use the same name for class and method, as this might trigger an (unintended) __construct of the class.
 * This is really weird behaviour, but documented here: http://php.net/manual/en/language.oop5.decon.php
 *
 */

namespace App\controllers;

class ErrorController
{
    /**
     * PAGE: index
     * This method handles the error page that will be shown when a page is not found
     */
    public function index()
    {
        // load views
        $msg = "";
        if(isset($_GET['controller'])) {
            $msg = "Cannot find controller " . $_GET['controller'];
        } else if (isset($_GET['action'])) {
            $msg = "Cannot find action " . $_GET['action'];
        } else {
            $msg = "Error";
        }
        echo $msg . "<br>";
    }
}
